package cn.amossun.starter.web.data.security.controller;

import cn.amossun.starter.common.util.Page;
import cn.amossun.starter.web.data.security.IDataSecurityVersion;
import cn.amossun.starter.web.data.security.entity.Query;
import cn.amossun.starter.web.data.security.entity.Result;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: Amos.Sun
 * @DateTime: 2020/07/07 19:58
 **/
@RestController
@AllArgsConstructor
@RequestMapping("/security/version")
@ConditionalOnBean(IDataSecurityVersion.class)
public class DataSecurityVersionController {

	public final IDataSecurityVersion dataSecurityVersion;

	@GetMapping("/page")
	public Result<Page> getRecords(Query query) throws Exception {
		return new Result(dataSecurityVersion.getRecords(query.getServiceName(), query.getCurrent(), query.getSize(), query.getVersion()));
	}

}
